
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'bill-form',
	'enableAjaxValidation'=>true,
	'focus'=>($cusinfo->c_fname),
	'clientOptions'=>array('validateOnSubmit'=>true,'inputContainer' => 'div'),


)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary(array($model,$cusinfo)); ?>
	
	<fieldset class='customerinfo'><legend>Customer info:  </legend> 
		<fieldset>
			<div class='row'>
				<?php echo $form->labelEx($cusinfo,'c_fname'); ?>
				<?php echo $form->textField($cusinfo,'c_fname'); ?><br />
				<?php echo $form->error($cusinfo,'c_fname'); ?>
			</div>
			
			<div class='row'>
				<?php echo $form->labelEx($cusinfo,'c_lastname'); ?>
				<?php echo $form->textField($cusinfo,'c_lastname'); ?><br />
				<?php echo $form->error($cusinfo,'c_lastname'); ?>
			</div>
		</fieldset>
		<fieldset>	
			<div class='row'>
				<?php echo $form->labelEx($cusinfo,'c_address'); ?>
				<?php echo $form->textField($cusinfo,'c_address'); ?><br />
				<?php echo $form->error($cusinfo,'c_address'); ?>
			</div>
			
			<div class='row'>
				<?php echo $form->labelEx($cusinfo,'c_email'); ?>
				<?php echo $form->textField($cusinfo,'c_email'); ?><br />
				<?php echo $form->error($cusinfo,'c_email'); ?>
			</div>
		</fieldset>
		<fieldset>	
			<div class='row' >
				<?php echo $form->labelEx($cusinfo,'c_phone'); ?>
				<?php echo $form->textField($cusinfo,'c_phone'); ?><br />
				<?php echo $form->error($cusinfo,'c_phone'); ?>
			</div>
			
			<div class='row'>
				<?php echo $form->labelEx($cusinfo,'c_purchasedate'); ?>
				<?php
		                $this->widget('zii.widgets.jui.CJuiDatePicker', array(
		                    'id'=>'c_purchasedate',
		                    'model'=>$cusinfo,
		                    'attribute'=>'c_purchasedate',
		                    // additional javascript options for the date picker plugin
		                    'options'=>array(
		                        'showAnim'=>'fold',
		                        'dateFormat'=>'yy-mm-dd',
		                    ),
		                    'htmlOptions'=>array(
		                    	'value'=>Date('Y-m-d'),
		                    ),
		                ));
		            ?><br />
				<?php echo $form->error($cusinfo,'c_purchasedate'); ?>
			</div>
		</fieldset>
	</fieldset>
	
	
	
	
	<fieldset class='billinfo'><legend>Bill info: </legend>
		<div id="addproduct">
			<dl>
			<dd class='row'>
				<?php echo $form->labelEx($model,'product_id'); ?>
				<?php echo $form->dropDownList($model,'product_id',Product::getProducts(),array('onchange'=>'getPrice()')); ?> 
				<?php echo $form->error($model,'product_id'); ?>
			</dd>
			<dd class='row' id='price'>
				<label>Price: </label> 
				<label id='_price'></label>
			</dd>
			<dd>
				<?php echo $form->labelEx($model,'amount'); ?>
				<?php echo $form->dropDownList($model,'amount',
						array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7'),
						array('onchange'=>'amountchanged()')); ?>
				<?php echo $form->error($model,'amount'); ?>
			</dd>
			<dd class='row'>
				<?php echo $form->labelEx($model,'money'); ?>
				<?php echo $form->hiddenField($model,'money')?>
				<label id="_money"></label>
				<?php echo $form->error($model,'money'); ?>
			</dd>
			<dd><a id= "addproduct" onclick="addproduct()">Add product</a> </dd>
			</dl>
		</div>
			
			<div id="shopcart" >
				<table>
					<tr>
						<td>Product Name</td>
						<td>Unit Price</td>
						<td>Quantity</td>
						<td>Money</td>
					</tr>
				</table>
			</div>
			
			<br class="clearer"/>
			<hr></hr>
		<dl>
		<dd class='row' style="float:right !important;">
			<?php echo $form->labelEx($cusinfo,'c_totalmoney'); ?>
			<label id="_totalMoney"></label>
			<?php echo $form->hiddenField($cusinfo,'c_totalmoney'); ?>
			<?php echo $form->error($cusinfo,'c_totalmoney'); ?>
		</dd>
		</dl>
		
	</fieldset>
	
	<div class="row buttons" style="margin: 0 auto 0 auto;">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->